import request from '@/utils/request.js'

/**
 *获取文章列表
 * @param {object} params
 * @returns promise
 */
export const getArticleList = params => {
  return request({
    method: 'GET',
    url: '/v1_1/articles',
    params
  })
}

/**
 *获取文章详情
 * @param {*} id
 * @returns promise
 */
export const getArticleInfo = id => {
  return request({
    method: 'GET',
    url: '/v1_0/articles/' + id
  })
}

/**
 *添加收藏
 * @param {*} id
 * @returns promise
 */
export const addArticleCollected = id => {
  return request({
    method: 'POST',
    url: '/v1_0/article/collections',
    data: {
      target: id
    }
  })
}

/**
 *取消收藏
 * @param {*} id
 * @returns promise
 */
export const deleteArticleCollected = id => {
  return request({
    method: 'DELETE',
    url: '/v1_0/article/collections/' + id
  })
}
